<template>
  <div>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="false"
      :row-selection="rowSelection"
      style='height: 300px;overflow-x: hidden; overflow-y: auto;'
    >
    </a-table>
  </div>

</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import columns from './indexColumns'

  export default {
    name: 'left',
    mixins: [JeecgListMixin],
    components: {
      // SearchModel
    },
    props: ['value'],
    data() {
      return {
        queryParam: {},
        // 表头
        columns: columns(this),
        url: {
          list: '/sjyzzx/sjZxzyAssistAccount/querySubjectListByAssistCode',
        },
        disableMixinCreated: true
      }
    },
    watch: {
      value: {
        immediate: true,
        handler(assistCode) {
          this.queryParam.assistCode = assistCode
          this.dataSource = []
          this.loadData(1)
        }
      }
    },
    created() {

    },
    mounted() {

    },
    computed: {
      rowSelection() {
        return {
          onChange: (selectedRowKeys, selectedRows) => {
            this.reportIds = []
            console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
            selectedRows.map((item)=>{
              this.reportIds.push({ 'subjectCode':item.subjectCode, 'subjectName':item.subjectName })
            })
            this.$emit('onSelectSubject', this.reportIds)
          }
        }
      }
    },
    methods: {
      updateList(){
        this.loadData()
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>